package com.tju.eduStatistics.controller;


import com.tju.Result;
import com.tju.eduStatistics.service.DailyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * <p>
 * 网站统计日数据 前端控制器
 * </p>
 *
 * @author gsc
 * @since 2022-01-19
 */
@RestController
@RequestMapping("/staservice/daily")
@CrossOrigin
public class DailyController {


    @Autowired
    private DailyService dailyService;
    //统计某一天的注册人数
    @PostMapping("registerCount/{day}")
    public Result registerCount(@PathVariable String day){
        dailyService.registerCount(day);
        return Result.ok();
    }

    //图标显示，返回日期的json数组  以及数量的json数组
    @GetMapping("showData/{type}/{begin}/{end}")
    public Result showData(@PathVariable String type,
                           @PathVariable String begin,
                           @PathVariable String end){
        Map<String,Object> map = dailyService.showData(type,begin,end);
        return Result.ok().data(map);
    }

}

